package entity;

import java.io.*;

/**
 * @ClassName FileUtils
 * @Description: TODO
 * @Author yjwu
 * @Date 2020/4/18 11:33
 **/
public class FileUtils {

    public static void copyFile(String fromPath, String toPath) throws IOException {
        long start = System.currentTimeMillis();
        FileInputStream fileInputStream = new FileInputStream(fromPath);
        BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);

        FileOutputStream fileOutputStream = new FileOutputStream(toPath);
        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream);

        int temp;
        while ((temp = bufferedInputStream.read()) != -1) {
            bufferedOutputStream.write(temp);
            System.out.println((char) temp);
        }
        long end = System.currentTimeMillis();
        long total = end - start;
        System.out.println("total=" + total);
        bufferedOutputStream.close();
        fileOutputStream.close();
        bufferedInputStream.close();
        fileInputStream.close();


    }
}
